﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using FanPages.Model;
using FanPages.Client.Gui.Desktop.Contracts;
using FanPages.Client.Gui.Desktop.Controllers;

namespace FanPages.Client.Gui.Desktop.Views
{
    public partial class FanItemCreation : Form
    {
        IFanItemController controller = new FanItemController();

        public FanItemCreation()
        {
            InitializeComponent();
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            try
            {
                FanItem fanItem = new FanItem();
                fanItem.Code = txtCode.Text;
                fanItem.Description = txtDescription.Text;
                fanItem.Name = txtName.Text;
                controller.Save(fanItem);
                MessageBox.Show("Fan Item created succesfully");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
    }
}
